package com.fudan.sys.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fudan.framework.base.BaseDao;
import com.fudan.framework.base.DaoService;
import com.fudan.sys.dao.PermissionDao;
import com.fudan.sys.dao.RoleDao;
import com.fudan.sys.entity.Permission;

@Service
public class PermissionService extends DaoService<Permission>{

	@Autowired
	private PermissionDao permissionDao;
	@Autowired
	private RoleDao roleDao;

	public List<Permission> getPermissionList() {
		return permissionDao.getPermissionList();
	}

	public List<String> findPermissionCodeByUser(Integer userId) {
		List<String> permissionList = roleDao.findPermissionCodeByUserId(userId);
		return permissionList;


	}

	public List<Permission> getPermissionListByRoleId(Integer roleId) {
		return permissionDao.getPermissionListByRoleId(roleId);
	}

	@Override
	protected BaseDao<Permission> injectDao() {
		return permissionDao;
	}
}
